package com.codenum.codegenerator;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

/**
* the Cnsbzrby type
*/
@SuppressWarnings("ALL")
public class Cnsbzrby {


        private static volatile Cnsbzrby instance;

        /**
        * 方法MethodMap
        */
        private Map<String, Method> methodMap = new HashMap<>(32);

        private Map<String, Object> saleTypeMap = new HashMap<>(64);

        public static Cnsbzrby getInstance() {
            if (instance == null) {
                synchronized (Cnsbzrby.class) {
                    if (instance == null) {
                        instance = new Cnsbzrby();
                    }
                }
            }
            return instance;
        }


        private Cnsbzrby() {

        }



    public  Boolean judgeInhtsomlwi(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeAvdhzpxpnf(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeTnmucpuhvd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeEvtxhecypd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeUhrbnxpkny(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeAcdcgejpba(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeLyjahzvuli(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeMuxtmagdnd(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }
    public  Boolean judgeEspwucyqci(String saleType){
        String methodName = Thread.currentThread().getStackTrace()[1].getMethodName();
        return judgeAttributeValue(saleType, methodName);
    }

    private String  inhtsomlwi;
    private String  avdhzpxpnf;
    private String  tnmucpuhvd;
    private String  evtxhecypd;
    private String  uhrbnxpkny;
    private String  acdcgejpba;
    private String  lyjahzvuli;
    private String  muxtmagdnd;
    private String  espwucyqci;


    public void setInhtsomlwi(String inhtsomlwi){
    this.inhtsomlwi = inhtsomlwi;
    }

    public String getInhtsomlwi(){
    return this.inhtsomlwi;
    }
    public void setAvdhzpxpnf(String avdhzpxpnf){
    this.avdhzpxpnf = avdhzpxpnf;
    }

    public String getAvdhzpxpnf(){
    return this.avdhzpxpnf;
    }
    public void setTnmucpuhvd(String tnmucpuhvd){
    this.tnmucpuhvd = tnmucpuhvd;
    }

    public String getTnmucpuhvd(){
    return this.tnmucpuhvd;
    }
    public void setEvtxhecypd(String evtxhecypd){
    this.evtxhecypd = evtxhecypd;
    }

    public String getEvtxhecypd(){
    return this.evtxhecypd;
    }
    public void setUhrbnxpkny(String uhrbnxpkny){
    this.uhrbnxpkny = uhrbnxpkny;
    }

    public String getUhrbnxpkny(){
    return this.uhrbnxpkny;
    }
    public void setAcdcgejpba(String acdcgejpba){
    this.acdcgejpba = acdcgejpba;
    }

    public String getAcdcgejpba(){
    return this.acdcgejpba;
    }
    public void setLyjahzvuli(String lyjahzvuli){
    this.lyjahzvuli = lyjahzvuli;
    }

    public String getLyjahzvuli(){
    return this.lyjahzvuli;
    }
    public void setMuxtmagdnd(String muxtmagdnd){
    this.muxtmagdnd = muxtmagdnd;
    }

    public String getMuxtmagdnd(){
    return this.muxtmagdnd;
    }
    public void setEspwucyqci(String espwucyqci){
    this.espwucyqci = espwucyqci;
    }

    public String getEspwucyqci(){
    return this.espwucyqci;
    }

    void setMethodMap(Map<String, Method> methodMap) {
        this.methodMap = methodMap;
    }

   void setSaleTypeMap(Map<String, Object> saleTypeMap) {
        this.saleTypeMap = saleTypeMap;
    }

    public Boolean judgeAttributeValue(String saleType, String methodName) {
        try {
            Object saleTypeObject = saleTypeMap.get(saleType);
            String targetMethod = methodName.replace("judge", "get");
            String attr = methodName.replace("judge", "");
            Method method = methodMap.get(targetMethod);
            Object invoke = method.invoke(saleTypeObject);
            return Objects.isNull(invoke) ? Boolean.FALSE : Objects.equals(invoke.toString().toLowerCase(), attr.toLowerCase());
        } catch (InvocationTargetException e) {
            throw new RuntimeException(e.getMessage());
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e.getMessage());
        }
    }

}